﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace T.FAS.Runtime.Action.Entity
{
    [Serializable]
    public class SGRetData
    {
        public SGRetData()
        { }
        public static SGRetData Ok()
        {
            return new SGRetData(1);
        }
        public static SGRetData NG(string message, bool userError = false)
        {
            return new SGRetData(userError ? 2 : 0, message);
        }
        [DataMember]
        public int state { get; set; }

        [DataMember]
        public string errmsg { get; set; }

        [DataMember]
        public object data { get; set; }

        public SGRetData(int state)
        {
            this.state = 1;
        }
        public SGRetData(int state, string message)
        {
            this.state = state;
            this.errmsg = message;
        }
        public SGRetData(object obj)
        {
            this.state = 1;
            data = obj;
        }
    }
}
